<?php
	if (isset($_POST["plugin"]) && (strlen($_POST["plugin"]) > 0)) $plugin = $_POST["plugin"]; else $plugin = NULL;
	if ($plugin == NULL) if (isset($_GET["plugin"]) && (strlen($_GET["plugin"]) > 0)) $plugin = $_GET["plugin"];
	if ($plugin != NULL){
		if (isset($setupdata['modules']['plugins']['path'])){
			if (file_exists($setupdata['modules']['plugins']['path']."/".$plugin."/include.php")) {
				include($setupdata['modules']['plugins']['path']."/".$plugin."/include.php");
			}
			if (isset($_GET['tempalate'])) $tempalate = $_GET['tempalate'];
			else $tempalate = "index.html";
			
			if (isset($smarty->compile_id)) $tmp = $smarty->compile_id;
			$smarty->compile_id = $plugin;
			
			$smarty->template_dir = $setupdata['modules']['plugins']['path']."/".$plugin."/admin/";
			$data['plugins'][$plugin]['template'] = $smarty->fetch($tempalate);
			
			if (isset($tmp)) $smarty->compile_id = $tmp;
			
			$smarty->template_dir = $setupdata['smarty_admin_template_dir'];
			unset($tempalate);
		}
	}
?>